package com.sdry.web.controller.llm;

import java.util.Collections;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.sdry.model.llm.Work;
import com.sdry.service.llm.WorkManageService;
import com.sdry.utils.ResponseUtil;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;

/**
 * 
 * @Title:WorkController
 * @Package com.sdry.web.controller.llm
 * @author llm
 * @date 2019年2月1日
 * @version 1.0
 */
@Controller
@RequestMapping("/workMana")
public class WorkController {
	
	@Resource
	private WorkManageService workManageService;
	
	/**
	 * 查询作业数据
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(value="/getWork")
	public void listAllProductStatusByTime(String positionName, HttpServletResponse response, HttpSession session) throws Exception{
		
		List<Work> list = workManageService.getWork(positionName, session);
		Collections.reverse(list);
		JSONObject jsonObject = new JSONObject();
		JsonConfig jsonConfig = new JsonConfig();
		JSONArray jsonArray = JSONArray.fromObject(list, jsonConfig);
		jsonObject.put("code", 0);
		jsonObject.put("data", jsonArray);
		jsonObject.put("count", 0);
		ResponseUtil.write(response, jsonObject);
	}
	
}
